package cn.zebra.dev.config.pay.wechat;

import com.google.common.collect.Maps;
import com.jpay.ext.kit.PaymentKit;
import com.jpay.weixin.api.WxPayApiConfigKit;

import java.util.Map;

public class LocalPaymentKit extends PaymentKit {


    /**
     * 预付订单再次签名
     * @param prepay_id
     * @return <Map<String, String>>
     */
    public static Map<String, String> prepayIdCreateSignByApp(String prepay_id) {
        Map<String, String> packageParams = Maps.newHashMap();
        packageParams.put("appid", WxPayApiConfigKit.getWxPayApiConfig().getAppId());
        packageParams.put("partnerid", WxPayApiConfigKit.getWxPayApiConfig().getMchId());
        packageParams.put("prepayid", prepay_id);
        packageParams.put("package", "Sign=WXPay");
        packageParams.put("noncestr", System.currentTimeMillis() + "");
        packageParams.put("timestamp", System.currentTimeMillis() / 1000 + "");
        String packageSign = PaymentKit.createSign(packageParams, WxPayApiConfigKit.getWxPayApiConfig().getPaternerKey());
        packageParams.put("sign", packageSign);
        return packageParams;
    }

}
